

const cv = require('opencv4nodejs');
const path = require('path');
const TypeDef = require('./typedef');
const ref = TypeDef.Ref;


let imgFile = path.join(__dirname, './img/1.jpg');

let imgMatrix = cv.imread(imgFile);

    let height  = imgMatrix.rows;
    let width = imgMatrix.cols;
    let wid4 = width - width%4;



const img = new cv.Mat(Buffer.from(imgMatrix.getData()), wid4, height, imgMatrix.type);

// console.log(imgMatrix)
//
// console.log("old width",width,wid4,imgMatrix.type,imgMatrix.channels)
//     let img = new cv.Mat(imgMatrix.rows,wid4,imgMatrix.type);
//


    // imgMatrix.copyTo(img);

let offInput = new TypeDef.ASVLOFFSCREEN();
offInput.u32PixelArrayFormat = TypeDef.ASVL_PAF_RGB24_B8G8R8;
offInput.i32Width = wid4;
offInput.i32Height = height;
offInput.ppu8Plane[0] = imageData;
offInput.pi32Pitch[0] =  offInput.i32Width * 3;

